package com.xdf.ecommerce.stream.defaultChannel;

import com.alibaba.fastjson.JSON;
import com.xdf.ecommerce.vo.SCSMessage;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;

/**
 * @author chanchaw
 * @create 2025-11-06 15:31
 */
@Slf4j
@RequiredArgsConstructor
@EnableBinding(Sink.class)
public class DefaultReciveService {
    @StreamListener(Sink.INPUT)
    public void receiveMessage(Object payload){
        SCSMessage scsMessage = JSON.parseObject(payload.toString(), SCSMessage.class);
        log.info("将接收到的消息反序列化后的结果是：[{}]", scsMessage.toString());
    }
}
